<template>
  <div id="container" />
  <Layout></Layout>
</template>
<script lang="ts" setup>
import Layout from '@/layout/index.vue';
import {websocketStoreWithOut} from '@/store/modules/websocket';
import {getAccessToken} from '@/utils/auth';
import mitt from "@/utils/bus";
const { connectWebSocket, getUserList, getChatList, $state: { websocket, imStore } } = websocketStoreWithOut();
const { wsCache } = useCache();
const route = useRoute();

onMounted(async () => {
  const isMain = wsCache.get('isMain');
  // 不是从主应用启动并且有token
  if(!isMain && getAccessToken()){
    connectWebSocket();
  }
})
onUnmounted(() => {
    mitt.all.clear();
})
</script>
